/**
*      author: Y_Yao
*      created: 2024-12-17 11:07:15
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
const int N = 3010;
int input[N][N];
int output[N][N];

void solve()
{
    int n;
    cin >> n;
    for(int i = 1;i <= n;i++)
    {
        for(int j = 1;j <= n;j++)
        {
            char s;
            cin >> s;
            input[i][j] = s == '#' ? 1 : 0;
        }
    }

    for(int i = 1;i <= n;i++)
    {
        for(int j = 1;j <= n;j++)
        {
            int x = i,y = j;
            int id = min(min(x,y),min(n+1-x,n+1-y));
            int times = id;
            times %= 4;

            for(int k = 0;k < times;k++)
            {
                int newx = y;
                int newy = n + 1 - x;
                x = newx;
                y = newy;
            }

            output[x][y] = input[i][j];
        }
    }


    for(int i = 1;i <= n;i++)
    {
        for(int j = 1;j <= n;j++)
        {
            if(output[i][j] == 1)
            {
                cout << '#';
            }
            else
            {
                cout << '.';
            }
        }
        cout << endl;
    }
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}